Resampling groups of rows in R